using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class PORequestEntryMap : EntityTypeConfiguration<PORequestEntry>
    {
        public PORequestEntryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FBrNo, t.FInterID, t.FEntryID });

            // Properties
            this.Property(t => t.FBrNo)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.FInterID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FEntryID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FUse)
                .HasMaxLength(50);

            this.Property(t => t.FSourceBillNo)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FMTONo)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FEntrySelfP0129)
                .HasMaxLength(255);

            this.Property(t => t.FEntrySelfP0130)
                .HasMaxLength(255);

            this.Property(t => t.FEntrySelfP0131)
                .HasMaxLength(255);

            this.Property(t => t.FEntrySelfP0132)
                .HasMaxLength(255);

            // Table & Column Mappings
            this.ToTable("PORequestEntry");
            this.Property(t => t.FBrNo).HasColumnName("FBrNo");
            this.Property(t => t.FInterID).HasColumnName("FInterID");
            this.Property(t => t.FEntryID).HasColumnName("FEntryID");
            this.Property(t => t.FItemID).HasColumnName("FItemID");
            this.Property(t => t.FQty).HasColumnName("FQty");
            this.Property(t => t.FCommitQty).HasColumnName("FCommitQty");
            this.Property(t => t.FPrice).HasColumnName("FPrice");
            this.Property(t => t.FUse).HasColumnName("FUse");
            this.Property(t => t.FFetchTime).HasColumnName("FFetchTime");
            this.Property(t => t.FUnitID).HasColumnName("FUnitID");
            this.Property(t => t.FAuxCommitQty).HasColumnName("FAuxCommitQty");
            this.Property(t => t.FAuxPrice).HasColumnName("FAuxPrice");
            this.Property(t => t.FAuxQty).HasColumnName("FAuxQty");
            this.Property(t => t.FSourceEntryID).HasColumnName("FSourceEntryID");
            this.Property(t => t.FSupplyID).HasColumnName("FSupplyID");
            this.Property(t => t.FAPurchTime).HasColumnName("FAPurchTime");
            this.Property(t => t.FPlanOrderInterID).HasColumnName("FPlanOrderInterID");
            this.Property(t => t.FAuxPropID).HasColumnName("FAuxPropID");
            this.Property(t => t.FSecCoefficient).HasColumnName("FSecCoefficient");
            this.Property(t => t.FSecQty).HasColumnName("FSecQty");
            this.Property(t => t.FSecCommitQty).HasColumnName("FSecCommitQty");
            this.Property(t => t.FSourceTranType).HasColumnName("FSourceTranType");
            this.Property(t => t.FSourceInterId).HasColumnName("FSourceInterId");
            this.Property(t => t.FSourceBillNo).HasColumnName("FSourceBillNo");
            this.Property(t => t.FMRPLockFlag).HasColumnName("FMRPLockFlag");
            this.Property(t => t.FOrderQty).HasColumnName("FOrderQty");
            this.Property(t => t.FMRPClosed).HasColumnName("FMRPClosed");
            this.Property(t => t.FMrpAutoClosed).HasColumnName("FMrpAutoClosed");
            this.Property(t => t.FPlanMode).HasColumnName("FPlanMode");
            this.Property(t => t.FMTONo).HasColumnName("FMTONo");
            this.Property(t => t.FEntrySelfP0129).HasColumnName("FEntrySelfP0129");
            this.Property(t => t.FEntrySelfP0128).HasColumnName("FEntrySelfP0128");
            this.Property(t => t.FEntrySelfP0130).HasColumnName("FEntrySelfP0130");
            this.Property(t => t.FEntrySelfP0131).HasColumnName("FEntrySelfP0131");
            this.Property(t => t.FEntrySelfP0132).HasColumnName("FEntrySelfP0132");
        }
    }
}
